<?php
	//用户登录界面
	include_once '../init.inc.php';
	print_r($_SESSION);
	$admin=new Admin();
	if(!$_SESSION["isLoginA"])
	{
		if (isset($_POST['action']) && $_POST['action'] == "login") //已经提交表单
		{
			$log= $admin->login($_POST['name'], $_POST['password']); //检验管理员登录
			if ($log){ //登录成功
				header("Location:index.php");
			}else{ //登录失败
				$message = "用户名或密码错误, 请重试.";
				$smarty->assign("className", "login-msg");
				$smarty->assign("message", $message);
			}
		}else{       //没有提交表单.显示登录界面
	
			$smarty->assign("className", "not-display");
			$smarty->assign("message", "");
		}
	}else{
		$admin->logout();
	}
	
	$smarty->display("admin/login.html");
?>